﻿<!DOCTYPE html>

<html>
<head>
<title></title>
<script type="text/javascript">
    function draw() {
        var canvas = document.getElementById("Canvas1");
        if (canvas.getContext) {
            var ctx = canvas.getContext("2d");
            ctx.beginPath();//开始绘制路径
            ctx.moveTo(75, 50);//以点(75,50)为起点
            ctx.lineTo(100, 75);//以(75,50)为起点到(100,75)为终点画一条直线
            ctx.lineTo(100, 25); //以(100, 75)为起点到(100, 25)为终点画一条直线
            //cts.closePath();//注意：当调用 fill 时，开放的路径会自动闭合，而无须调用 closePath 。
            ctx.fill(); //填充
            //ctx.stroke();//只绘边框
        }
    }
    window.onload = draw;
</script>
</head>
<body>
    <canvas id="Canvas1" width="150" height="150"></canvas>
</body>
</html>
